package com.itheima.mapper;

import com.itheima.pojo.Empl;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmplMapper {

    @Select("select count(*) from  emp")
    Integer selectTotal();
    @Select("select *from emp limit #{start},#{pagesize}")
    List<Empl> selectPage(Integer start,Integer pagesize);

    @Select("select *from emp")
    List<Empl> selectByHelper();


    List<Empl> selectByChoice(String name, Short gender, LocalDate begin, LocalDate end);

    void delete(List<Integer> ids);

    void insert(Empl empl);
    @Select("select *from emp where id=#{id}")
    Empl selectById(Integer id);

    void update(Empl empl);
    @Select("select *from emp where username=#{username} and password=#{password}")
    Empl login(String username, String password);
    @Delete("delete from  emp where dept_id=#{deptId}")
    void deleteByDeptId(Integer deptId);
}
